home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: What wrong with this code ??????
- Date: Wed, 10 Jan 96 15:38:22 GMT
- Organization: none
- Message-ID: <821288302snz@genesis.demon.co.uk>
- References: <4bjl81$qiu@wumpus.cc.uow.edu.au> <JARNOT.96Jan9145744@box10.dstar.iddis.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <JARNOT.96Jan9145744@box10.dstar.iddis.com>
- jarnot@iddis.com "Kevin J. Jarnot" writes:
-
- >You should have an interesting value stored in c! BTW, this is
- >valid C code, although you'll get a warning about mixing pointers
- >and integers.
-
- getchar evaluates to a pointer to a function. This cannot be legally
- assigned to an integer in C (it violates a constraint and hence a
- diagnostic is required).
-
- In comparison casting a pointer to an integer results in implementation-
- defined behaviour. However you're no better off as far as portability is
- concerned since the implementation could make the behaviour undefined by
- stating that no integer is big enough to hold the result. The compiler
- doesn't have to generate a diagnostic however.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-